import request from '@/util/request'

export const getJobDetail = async (positionId) => {
    try {
        const response = await request.get('/seeker/position/getPositionDetail',{
            params: {
                positionId
            }
        });

        return response.data;
    } catch (error) {
        console.error(' 201 获取搜索框输入内容失败:', error);
        throw error;
    }
};

//判断是否收藏
export const isCollected = async (positionId) => {
    console.log("判断是否收藏",positionId)
    try {
        const response = await request.get('/seeker/position/judgeCollect', {
            params: {
                positionId:positionId
            }
        });

        return response.data;
    } catch (error) {
        console.error(' 201 判断是否收藏失败:', error);
        throw error;
    }
};

//收藏职位
export const collectJob = async (data) => {
    try {
        const response = await request.post('/seeker/position/collectPositionById',{}, {
            params:data
        });


        return response.data;
    } catch (error) {
        console.error(' 201 收藏职位失败:', error);
        throw error;
    }
};

//获取所有职位行业列表
export const getJobIndustry = async () => {
    try {
        const response = await request.get('/common/getAllPositionIndustries');
        return response.data;
    } catch (error) {
        console.error('获取所有职位行业列表失败', error);
        throw error;
    }
};
